import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import userLoginPage from '@/pages/user/userLoginPage.vue'
import userRegisterPage from '@/pages/user/userRegisterPage.vue'
import userManagePage from '@/pages/admin/userManagePage.vue'
import personCenterPage from '@/pages/personCenterPage.vue'
import updatePasswordPage from '@/pages/updatePasswordPage.vue'
import pictureUpload from '@/pages/addPicturePage.vue'
import pictureUploadPage from '@/pages/addPicturePage.vue'
import addPicturePage from '@/pages/addPicturePage.vue'
import pictureManagePage from '@/pages/admin/pictureManagePage.vue'
import pictureDetailPage from '@/pages/pictureDetailPage.vue'
import addPictureBatchPage from '@/pages/admin/addPictureBatchPage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '主页',
      component: HomeView,
    },
    {
      path: '/user/login',
      name: '用户登录',
      component:userLoginPage,
    },
    {
      path: '/user/register',
      name: '用户注册',
      component: userRegisterPage,
    },
    {
      path: '/admin/userManage',
      name: '用户管理',
      component: userManagePage,
    },
    {
      path: '/user/personCenter',
      name: '用户中心',
      component: personCenterPage,
    },
    {
      path: '/user/updatePassword',
      name: '修改密码',
      component: updatePasswordPage,
    },
    {
      path: '/addPicture',
      name: '图片上传',
      component: addPicturePage,
    },
    {
      path: '/addPicture/batch',
      name: '图片批量上传',
      component: addPictureBatchPage,
    },
    {
      path: '/admin/pictureManage',
      name: '图片管理',
      component: pictureManagePage,
    },
    {
      path: '/picture/:id',
      name: '图片详情',
      component: pictureDetailPage,
      props: true,
    },

    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
  ],
})

export default router
